package org.kjtc.mapper;

import org.kjtc.entity.ChargingStation;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.jdbc.SQL;

/**
 * Created by dell on 2018/12/10.
 */
public class ChargingStationProvider {
    public String getChargingStationList(ChargingStation chargingStation) {

        String newSql = " charging_station_id as chargingStationID," +
                " charging_station_name as chargingStationName," +
                " equipment_count as equipmentCount," +
                " business_id as businessId," +
                " address as address," +
                " construct_status as constructStatus," +
                " update_dttm as updateDTTM" +
                " from charging_station" +
                " where 1=1";
        if (!StringUtils.isEmpty(chargingStation.getChargingStationID())) {
            newSql += " and charging_station_id = #{charging_station_id}";
        }

        SQL sql = new SQL().SELECT(newSql);
        //sql.ORDER_BY("ChargingStationID ");
        return sql.toString();
    }
}
